package cn.ges.type;

import cn.ges.string.StringUtil;

import java.util.List;
import java.util.Map;

/**
 * @author gespent@163.com
 * @date 2019/08/06 17:16
 */
public class BlankHelper {

    public static boolean listIsBlank(List list) {
        return list == null || list.isEmpty() || list.get(0) == null;
    }

    public static boolean mapIsNotNull(Map map) {
        return map != null && !map.isEmpty();
    }

    public static boolean mapKeyIsNotNull(Map map, Object key) {
        if (BlankHelper.mapIsNotNull(map)) {
            return map.get(key) != null;
        }
        return false;
    }

    public static boolean listIsNotBlank(List list) {
        return !BlankHelper.listIsBlank(list);
    }

    public static boolean stringIsBlank(String str) {
        return StringUtil.isBlank(str);
    }

    public static boolean stringIsNotBlank(String str) {
        return !BlankHelper.stringIsBlank(str);
    }
}
